/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedbean;

import entity.BranchEntity;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;

/**
 *
 * @author Amelia
 */
@ManagedBean
@ViewScoped
public class EditBranchManagedBean implements Serializable
{
    private BranchEntity branchToEdit;

    /** Creates a new instance of EditBranchManagedBean */
    public EditBranchManagedBean() {
    }
    
    
    public void initView(PhaseEvent event)
    {
        if(branchToEdit == null)
        {
            branchToEdit = (BranchEntity)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("selectedBranch");
        }
    }

    
    
    public BranchEntity getBranchToEdit() {
        return branchToEdit;
    }

    public void setBranchToEdit(BranchEntity branchToEdit) {
        this.branchToEdit = branchToEdit;
    }
}
